<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>商品更新 - 绿色农业后台管理系统</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="ZZMLY,后台管理系统">
<meta name="description" content="ZZMLY是一个基于Bootstrap 的后台管理系统">
<meta name="author" content="yinqi">
<link th:href="@{BMS/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{BMS/css/materialdesignicons.min.css}" rel="stylesheet">
<!--标签插件-->
<link rel="stylesheet" th:href="@{BMS/js/jquery-tags-input/jquery.tagsinput.min.css}">
<link th:href="@{BMS/css/style.min.css}" rel="stylesheet">
</head>
  
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    <!--End 左侧导航-->
    <!--头部信息-->
    <!--End 头部信息-->
    <!--页面主要内容-->
    <main class="lyear-layout-content">

      <div class="container-fluid">

        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">

                <form action="PostPupdatePuduct" method="post" class="row">
                  <div class="form-group col-md-12">
                    <label>商品图片</label>
                    <div class="form-controls">

                      <input name="productImage" id="productImage"  th:value="${productsinfor.productImage}" type="hidden">

                      <ul class="list-inline clearfix lyear-uploads-pic">
                        <li class="col-xs-4 col-sm-3 col-md-2">
                          <figure>
                            <img th:src="${productsinfor.productImage}" alt="图片" id="img" type="hidden">
                            <figcaption>
<!--                              <a class="btn btn-round btn-square btn-danger" href="#!"><i class="mdi mdi-eye"></i></a>-->
                              <a class="btn btn-round btn-square btn-danger" href="#!"><i class="mdi mdi-delete"></i></a>
                            </figcaption>
                          </figure>
                        </li>
                        <li class="col-xs-4 col-sm-3 col-md-2">

                          <input  type="file" title="点击上传" id="imagesFile" >

                          <!--                          <a class="pic-add" id="add-pic-btn" href="#!" ></a>-->
                        </li>
                      </ul>
                    </div>
                  </div>
                    <input name="productId" type="hidden" th:value="${productsinfor.productId}">
                  <div class="form-group col-md-12">
                    <label for="productTypeId">商品类型</label>
                    <div class="form-controls">
                      <select name="productTypeId" class="form-control" id="productTypeId">
                        <option value="1">蔬菜</option>
                        <option value="2">水果</option>
                        <option value="3">生鲜</option>
                        <option value="4">菌菇</option>
                      </select>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="productName">商品名字</label>

                    <input type="text" class="form-control" id="productName" name="productName" th:value="${productsinfor.productName}" placeholder="商品名字" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="productPrice">商品价格</label>
                    <input type="text" class="form-control" id="productPrice" name="productPrice" th:value="${productsinfor.productPrice}" placeholder="商品单价" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="productTotal">商品总数</label>
                    <input type="text" class="form-control" id="productTotal" name="productTotal" th:value="${productsinfor.productTotal}" placeholder="商品单价" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="productIntroduce">商品简介</label>
                    <textarea class="form-control" id="productIntroduce" name="productIntroduce" rows="5" th:value="${productsinfor.productIntroduce}" placeholder="商品简介"></textarea>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="producerId">种植商编号id</label>
                    <input type="text" class="form-control" id="producerId" name="producerId" th:value="${productsinfor.producerId}" placeholder="商品单价" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="producerName">种植户名字</label>
                    <input class="js-tags-input form-control" type="text" id="producerName" name="producerName" th:value="${productsinfor.producerName}" placeholder="种植户名字"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="producerNumber">种植户账号</label>
                    <input class="js-tags-input form-control" type="text" id="producerNumber" name="producerNumber" th:value="${productsinfor.producerNumber}" placeholder="种植户账号"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="productCreatTime">商品生产日期</label>
                    <input type="datetime-local" class="form-control" id="productCreatTime" name="productCreatTime" th:value="${productsinfor.productCreatTime}"  />
                  </div>
<!--                  <div class="form-group col-md-12">-->
<!--                    <label for="productReleaseTime">商品上架日期</label>-->
<!--                    <input type="datetime-local" class="form-control" id="productReleaseTime" name="productReleaseTime"  />-->
<!--                  </div>-->
<!--                  <div class="form-group col-md-12">-->
<!--                    <label for="state">状态</label>-->
<!--                    <input type="radio" name="productState" value="已上传" id="state" ><label for="state"><p style="color: #ccc">已上传</p></label>-->
<!--                  </div>-->
                  <div class="form-group col-md-12">
                    <button type="submit" class="btn btn-primary ajax-post" target-form="add-form">确定更新</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                  </div>
                </form>

              </div>
            </div>
          </div>

        </div>

      </div>

    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" th:src="@{BMS/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{BMS/js/bootstrap.min.js}"></script>
<!--<script type="text/javascript" th:src="@{BMS/js/perfect-scrollbar.min.js}"></script>-->
<!--标签插件-->
<!--<script th:src="@{BMS/js/jquery-tags-input/jquery.tagsinput.min.js}"></script>-->
<!--<script type="text/javascript" th:src="@{BMS/js/main.min.js}"></script>-->
<script>
  $(function (){
    var btn = $('#imagesFile');

    btn.change(function (){
      var file = btn[0].files[0]
      var data = new FormData();
      data.append('file',file);
      console.log(data)
      $.ajax({
        url:'/upFile',
        type:'post',
        data:data,
        processData:false,
        contentType:false,
        success:function (response){
          console.log(response)
          $("#productImage").attr("value",response)
          $("#img").attr("src",response)
        }
      })
    })
  })
</script>
</body>
</html>